package com.example.sys.mapper;

import com.example.common.entity.LoginLog;
import com.example.sys.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CommonMapper {


    @Insert("insert into sys_login_log(id, user_id, agent, ip, type) " +
            "values(#{log.id}, #{log.userId}, #{log.agent}, #{log.ip}, #{log.type})")
    int loginLog(@Param("log") LoginLog loginLog);

    @Select("select count(id) from sys_sms_log where phone = #{phone} and datediff(now(), create_time) = 0")
    int getSmsLog(String phone);
}
